package com.example.project3.util;

import org.springframework.stereotype.Component;

import java.util.Random;

/**
 * @ClassName VerificationCode .java
 * @Description empty
 * @Author LiuJinyu
 * @Date 2023/5/29 20:24
 * @Version 1.0
 */
@Component
public class VerificationCode {
    private final static String ROOT_CODE = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
    private final Random random = new Random();
//    private final static

    public String getVerificationCodeString() {
        StringBuilder buffer = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            buffer.append(ROOT_CODE.charAt(random.nextInt(ROOT_CODE.length())));
        }
        return buffer.toString();
    }
}
